<html>
<head><meta charset="utf-8"><title>rustfix on file · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustfix.20on.20file.html">rustfix on file</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="219782284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustfix%20on%20file/near/219782284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustfix.20on.20file.html#219782284">(Dec 13 2020 at 21:28)</a>:</h4>
<p>Is there any way to run rustfix on a single file rather than in a Cargo package?</p>



<a name="219783618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustfix%20on%20file/near/219783618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustfix.20on.20file.html#219783618">(Dec 13 2020 at 21:56)</a>:</h4>
<p><code>rustfix</code> in general needs type information, right?  So it might not be possible the way it is for rustfmt (which only needs to parse).</p>



<a name="219783866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustfix%20on%20file/near/219783866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustfix.20on.20file.html#219783866">(Dec 13 2020 at 22:01)</a>:</h4>
<p><code>rustfix</code> only applies the suggestions from <code>rustc</code>, right? So it needs to check the entire project</p>



<a name="219783928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustfix%20on%20file/near/219783928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustfix.20on.20file.html#219783928">(Dec 13 2020 at 22:02)</a>:</h4>
<p>Maybe there's an option to only apply suggestions on a single file though?</p>



<a name="219783996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustfix%20on%20file/near/219783996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustfix.20on.20file.html#219783996">(Dec 13 2020 at 22:03)</a>:</h4>
<p>I can't find one though</p>



<a name="219784183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustfix%20on%20file/near/219784183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustfix.20on.20file.html#219784183">(Dec 13 2020 at 22:07)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125270">scottmcm</span> <a href="#narrow/stream/122651-general/topic/rustfix.20on.20file/near/219783618">said</a>:</p>
<blockquote>
<p><code>rustfix</code> in general needs type information, right?  So it might not be possible the way it is for rustfmt (which only needs to parse).</p>
</blockquote>
<p>But you can run <code>rustc</code> on a single file...</p>



<a name="219784201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustfix%20on%20file/near/219784201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustfix.20on.20file.html#219784201">(Dec 13 2020 at 22:07)</a>:</h4>
<p>I guess I wasn't clear enough: I meant that I have a standalone file that I want to run <code>rustfix</code> on (it's not part of a project).</p>



<a name="219784391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustfix%20on%20file/near/219784391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustfix.20on.20file.html#219784391">(Dec 13 2020 at 22:11)</a>:</h4>
<p>Apparently there is no "standalone" <code>rustfix</code> binary, only <code>cargo-fix</code>:</p>
<blockquote>
<p>Currently, rustfix is split into two crates:</p>
<ul>
<li><code>rustfix</code>, a library for consuming and applying suggestions in the format that <code>rustc</code> outputs</li>
<li>and <code>cargo-fix</code>, a binary that works as cargo subcommand and that end users will use to fix their code.</li>
</ul>
</blockquote>



<a name="219784840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/rustfix%20on%20file/near/219784840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/rustfix.20on.20file.html#219784840">(Dec 13 2020 at 22:21)</a>:</h4>
<p>Yeah, that's what I thought :/</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>